﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using GrayParrot.RabbitMQ;
using Test.BLL;

namespace TestRabbitMQ
{
    public class RabbitMQPippoPazzoSubscriber : Subscriber<RabbitMQPippoPazzoSubscriber> 
    {
        public RabbitMQPippoPazzoSubscriber()
            : base("PippoPazzo-Test")
        {

        }

        public override bool Receive(byte[] message)
        {
            MessageBusBase<MessaggioTest> m_body = (MessageBusBase<MessaggioTest>)message.DeSerialize();

            Console.WriteLine(m_body.Body.Name);

            //Thread.Sleep(5000);  // wait 5 sec

            //throw new Exception("Prova di errore");

            return true;
        }
    }
}
